class Solution {
public:

  // 暴力
    vector<vector<int>> largestLocal(vector<vector<int>>& grid) {
        int n = grid.size();
        vector<vector<int>> res(n-2, vector<int> (n-2, 0));
        for(int i = 0;i <= n-3; ++i){
            for(int j = 0; j <= n-3; ++j){
                // 在3*3矩阵中找最大值
                int temp = 0;
                for(int k = i; k < i+3; ++k){
                    for(int l = j; l < j+3; ++l)
                        temp = temp > grid[k][l]? temp : grid[k][l];
                }
                res[i][j] = temp;
            }
        }
        return res;
    }

    
};